<!-- toaster directive -->
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-sref="main.tpl.homePage"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active" ng-bind="title"></li>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-body">
                    <form ng-submit="searchRe()" class="ng-pristine ng-valid">
                        <div class="form-group">
                        <div class="col-sm-2">
                            <input type="text" class="form-control" ng-model="param.title"
                                   placeholder="标题">
                        </div>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="param.type" name="type" id="type" ng-options="type.typeId as type.typeName for type in typeList">
                                <option value="">--请选择--</option>
                            </select>
                        </div>

                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" ng-click="searchRe()" type="submit">查 询</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button class="ifc-btn btn-dark" ng-click="clearSearch()" type="reset">清 空</button></label>
                        </div>
                            <div class="col-md-1">
                                <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" ui-sref = "main.web.affiche.add()"  >添加资讯</button></label>
                            </div>
                            <div class="col-md-1">
                                <label class="col-sm-1 control-label"><button type="button" ng-click="batchDelete()" class="ifc-btn btn-danger">删 除</button></label>
                            </div>
                            <div class="col-md-1">
                                <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" ng-click="showTypeModel()">类别管理</button></label>
                            </div>
                            <div class="col-md-1">
                                <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" ng-click="showLabModel()">标签管理</button></label>
                            </div>
                            <div class="col-md-1">
                                <label class="col-sm-1 control-label" >
                                    <button type="button"  class="ifc-btn btn-success editSortBtn" ng-click="editSort($event)" >拖拽排序</button>
                                    <button type="button"  style="display: none" class="ifc-btn btn-success saveSortBtn" ng-click="saveSort($event)" >保存</button>
                                </label>
                            </div>
                        </div>
                    </form>
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center sort" >
                    <thead>
                    <tr>
                        <th><input type="checkbox" ng-click="selectAll($event)"/>全选</th>
                        <th>标题</th>
                        <th>资讯类别</th>
                        <th>操作</th>
                        <th>操作时间</th>
                        <th>操作人</th>
                    </tr>
                    </thead>
                    <tbody id="bannerList">
                    <tr ng-repeat="item in pageInfo.records">
                        <td class="v-middle">
                            <input type="checkbox" name="selected" ng-checked="isSelected(item.id)" ng-click="updateSelection($event,item)"/>
                        </td>
                        <td class="v-middle" style="display: none">{{item.id}}</td>
                        <td class="v-middle">{{item.title}}</td>
                        <td class="v-middle">{{item.signType}}</td>
                        <td class="v-middle">
                          <span>
                            <a   ui-sref="main.web.affiche.update({id: item.id})" class="btn btn-sm btn-default">
                            <i class="fa fa-edit m-r-xs text-sm"></i>编辑
                           </a>
                        </span>
                        </td>
                        <td class="v-middle">{{item.updateTimeStr}}</td>
                        <td class="v-middle">{{item.createPerson}}</td>
                    </tr>
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->

            <!-- 底部分页 -->
            <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
        </div><!-- /.panel -->
    </div><!-- /.wrapper-data -->
    <!--类别管理MOdel-->
    <form id="saveType" name="saveType">
        <div class="modal fade bs-example-modal-lg" tabindex="-1" data-backdrop="static" id="TypeModel" role="dialog" aria-labelledby="CashLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="CashLabel">类别管理</h4>
                    </div>
                    <div class="modal-header">
                        <button type="button" id="saveAppsub" class="btn btn-primary" ng-click="addTr('Typetable')">添加分类</button>
                    </div>
                    <div id="ApplyBody" class="modal-body" style="padding: 0px">
                        <table id="Typetable" class="table table-striped b-t b-light text-center">
                            <thead>
                            <tr>
                                <th>类别名称</th>
                                <th>序号</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="item in results">
                                <td class="v-middle">
                                    <span ng-show="item.isEdit=='1'">{{item.typeName}}</span>
                                    <input class="form-control require" data-title="类型名称" ng-show="item.isEdit=='0'" type="text" ng-model="item.typeName">
                                </td>
                                <td class="v-middle">
                                    <span ng-show="item.isEdit=='1'"> {{item.sortNum}}</span>
                                    <input class="form-control require" data-title="排序号" ng-show="item.isEdit=='0'" type="text" ng-model="item.sortNum">
                                </td>
                                <td class="v-middle">
                                    <a  class="btn btn-sm btn-default" ng-click="edit(item,$event)">
                                        <i class="fa fa-edit m-r-xs text-sm" ></i>{{item.isEdit=='1'?"编辑":"保存"}}</a>
                                    <button type="button" ng-click="disableItem(item,$event)" class="btn btn-sm btn-default m-l-xs">
                                        <i class="fa fa-ban m-r-xs text-sm"></i>删除</button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </form>



    <!--标签管理MOdel-->
    <form id="saveLab" name="saveLab">
        <div class="modal fade bs-example-modal-lg" tabindex="-1" data-backdrop="static" id="LabModel" role="dialog" aria-labelledby="CashLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="Label">标签管理</h4>
                    </div>
                    <div class="modal-header">
                        <button type="button" id="addlab" class="btn btn-primary" ng-click="addLabTr()">添加标签</button>
                    </div>
                    <div id="addlabBody" class="modal-body" style="padding: 0px">
                        <table id="labtable" class="table table-striped b-t b-light text-center">
                            <thead>
                            <tr>
                                <th>标签名称</th>
                                <th>是否热门</th>
                                <th>关联文章数</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="item in labresults">
                                <td class="v-middle">
                                    <span ng-show="item.isEdit=='1'">{{item.labName}}</span>
                                    <input class="form-control require" data-title="标签名称" ng-show="item.isEdit=='0'" type="text" ng-model="item.labName">
                                </td>
                                <td class="v-middle">
                                    <span ng-show="item.isEdit=='1'">{{item.labType=='RM'?'是':'否'}}</span>
                                    <select class="form-control" ng-show="item.isEdit=='0'" ng-model="item.labType">
                                        <option value="RM">是</option>
                                        <option value="">否</option>
                                    </select>
                                </td>
                                <td class="v-middle">
                                    <span> {{item.affsum}}</span>
                                </td>
                                <td class="v-middle">
                                    <a  class="btn btn-sm btn-default" ng-click="editlab(item,$event)">
                                        <i class="fa fa-edit m-r-xs text-sm" ></i>{{item.isEdit=='1'?"编辑":"保存"}}</a>
                                    <button type="button" ng-click="disableLabItem(item,$event)" class="btn btn-sm btn-default m-l-xs">
                                        <i class="fa fa-ban m-r-xs text-sm"></i>删除</button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <span data-ng-include=" 'src/tpl/labpageInfo.html' "></span>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </form>
</div><!-- /.wrapper-md -->